package top.hongthorn.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import top.hongthorn.pojo.Chaser;
import top.hongthorn.mapper.ChaserMapper;
import top.hongthorn.pojo.User;
import top.hongthorn.service.ChaserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * 驱逐舰编队 服务实现类
 * </p>
 *
 * @author 泓宇网络科技工作室
 * @since 2023-12-28 00:47:55
 */
@Service
@Transactional
public class ChaserServiceImpl extends ServiceImpl<ChaserMapper, Chaser> implements ChaserService {

    @Autowired
    private ChaserMapper chaserMapper;

    @Override
    public Map findChaser(Integer startIndex, Integer pageSize) {
        Map<String, Object> map = new HashMap<>();
        Page<Chaser> chaserPage = new Page<>(startIndex, pageSize);
        IPage<Chaser> iPage = this.page(chaserPage, null);
        map.put("code", 0);
        map.put("msg", "true");
        map.put("count", iPage.getTotal());
        map.put("data", iPage.getRecords());
        return map;
    }
}
